import React from 'react'

//引入Routes Route
import { Routes, Route, Navigate } from 'react-router-dom'

//引入Main和Login&404组件
import Main from './components/Main'
import Login from './components/Login'
import NotFund from './components/404'

//引入Main的二级路由
import About from './components/Main/About'
import Home from './components/Main/Home'
export default function App() {
  return (
    // 
    <div>
      <Routes>
        <Route path='/login' element={<Login />} />
        <Route path='/main' element={<Main />} >
          <Route path='/main/about' element={<About/>}/>
          <Route path='/main/home' element={<Home/>}/>
        </Route>
        {/* 当访问页面不存在的时候 会进入*号中 执行当前组件 */}
        <Route path='*' element={<NotFund />} />
        {/* 路由重定向
          当访问跟路径的时候,会让路由自动跳转至其他页面
        */}
        <Route path='/' element={<Navigate to={'/login'} />} />


      </Routes>
    </div>
  )
}



